package com.coin900.coin.service.coin;

import com.coin900.coin.persist.coin.CoinCoinVO;
import com.value.mybatis.IDaoRouter;
import com.value.mybatis.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author shui
 * @create 2018-1-23
 */
@Service
public class CoinCoinService implements ICoinCoinService {

    @Override
    public List<CoinCoinVO> loadCoinCoin(Map<String, Object> params){
        return this.daoRouter.query("CoinCoin.loadCoinCoin",params);
    }

    @Override
    public List<CoinCoinVO> loadCoinCoinForPage(Pagination pagination) {
        return this.daoRouter.query("CoinCoin.loadCoinCoinForPage",pagination);
    }

    @Override
    public CoinCoinVO getCoin(Long coinId) {
        Map<String,Object> params = new HashMap<>();
        params.put("id",coinId);
        params.put("dataStatus",1);
        return this.daoRouter.queryForObject("CoinCoin.loadCoinCoin",params);
    }

    @Override
    public List<CoinCoinVO> loadCoinCoinPayforTokenAll(Map<String, Object> params) {
        return this.daoRouter.query("CoinCoin.loadCoinCoinPayforTokenAll",params);
    }

    @Override
    public void insertCoinCoin(CoinCoinVO coinCoinVO){
        this.daoRouter.insert("CoinCoin.insertCoinCoin", coinCoinVO);
    }

    @Override
    public void updateCoinCoin(CoinCoinVO coinCoinVO){
        this.daoRouter.update("CoinCoin.updateCoinCoin", coinCoinVO);
    }

    @Override
    public void deleteCoinCoin(CoinCoinVO coinCoinVO){
        this.daoRouter.update("CoinCoin.deleteCoinCoin", coinCoinVO);
    }

    @Autowired
    private IDaoRouter daoRouter;

}